Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix overload precedence #1915

Merged
merged 1 commit into from
Nov 7, 2023
Merged

fix overload precedence #1915

merged 1 commit into from
Nov 7, 2023

Conversation

mbostock
Copy link
Member

@mbostock mbostock commented Nov 3, 2023

This fixes a TypeScript type inference bug in a case like this:

Plot.plot({
  marks: [
    Plot.differenceY(
      stocks,
      Plot.normalizeY(
        Plot.groupX(
          {y1: Plot.find((d) => d.Symbol === "GOOG"), y2: Plot.find((d) => d.Symbol === "AAPL")},
          {x: "Date", y: "Close", curve: "cardinal", tension: 0.1}
        )
      )
    )
  ]
})

Previously, TypeScript would assume that the normalizeY transform was being passed a single argument of basis; now it correctly assumes that it is being passed a single argument of options.

@mbostock mbostock requested a review from Fil November 3, 2023 16:00
@mbostock mbostock mentioned this pull request Nov 3, 2023
9 tasks
@Fil
Copy link
Contributor

Fil commented Nov 6, 2023

Confirmed (both error and fix) with areaY.

@mbostock mbostock merged commit 4cf4d73 into main Nov 7, 2023
1 check passed
@mbostock mbostock deleted the mbostock/fix-option-overload-type branch November 7, 2023 17:12
chaichontat pushed a commit to chaichontat/plot that referenced this pull request Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants